fix(DApplication): wire up applicationHomePage in about dialog - #778
Conversation
Reviewer's GuideThe PR turns DApplication’s previously unused homepage setting into an effective about-dialog website link and adds an optional website display name, with non-empty overrides preserving distribution defaults and custom about-dialog instances unaffected. Sequence diagram for customized about dialog website settingssequenceDiagram
participant App as DApplication
participant Dialog as DAboutDialog
App->>App: handleAboutAction()
App->>Dialog: setWebsiteLink(applicationHomePage())
App->>Dialog: setWebsiteName(applicationWebsiteName())
Dialog-->>App: Display custom values or distribution defaults
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA. |
46c5ea3 to
b6a74c4
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 语法正确,逻辑清晰,边界处理完善。空字符串通过 !homePage.isEmpty() 前置守卫拦截,无效 URL 通过 host.isEmpty() 三元回退处理,逻辑完备。 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 代码结构清晰,注释完整。变量命名 homePage/host 语义明确,const 修饰符使用得当,代码风格与周围代码一致。 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 性能良好,资源使用合理。applicationHomePage() 仅调用一次并缓存到局部变量 homePage,QUrl 临时对象开销可忽略(关于对话框为一次性 UI 操作,非热路径)。 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 存在0个安全漏洞,安全合规。applicationHomePage 属性值来自应用开发者设置的内部属性,非外部用户输入;QUrl 解析为纯字符串操作,不涉及命令执行或网络请求;setWebsiteLink/setWebsiteName 为 Qt 对话框 UI 设置方法,无注入风险。 💡 改进建议代码示例// 代码实现良好,无需改进
// 当前实现已正确处理所有边界场景:
// 1. 空字符串 -> !homePage.isEmpty() 守卫拦截
// 2. 有效 URL (https://example.com) -> host() 返回 "example.com"
// 3. 无效 URL (example.com 无 scheme) -> host() 返回空 -> 回退为原始字符串
// 4. 非 URL 字符串 -> host() 返回空 -> 回退为原始字符串本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia, mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
DApplication::handleAboutAction() did not call DAboutDialog::setWebsiteName/setWebsiteLink when auto-creating the about dialog, so applications could not customize the website row and always fell back to the distribution default. This change wires the existing applicationHomePage() getter to the about dialog: when set (non-empty), it is applied as the website link, and its URL host is used as the display name (e.g. "https://example.com" -> "example.com"); if the value is not a parseable URL the raw value is used. No new public API is added, keeping ABI compatibility. Closes: DDE-211
b6a74c4 to
776c613
Compare
|
/forcemerge |
|
This pr force merged! (status: blocked) |
背景
DApplication::handleAboutAction()在自动创建关于对话框时,只设置了 productName / productIcon / version / description / license / acknowledgement,未调用DAboutDialog::setWebsiteName/setWebsiteLink,导致应用无法自定义网站行,始终回退到发行版默认值。根因
DAboutDialog本身已具备setWebsiteName()/setWebsiteLink()能力,但DApplication的自动创建路径没有接线。DApplication已有applicationHomePage/setApplicationHomePage属性,文档明确写着「主要用于在关于对话框中进行展示」,但该属性从未被handleAboutAction()读取,属于遗留死 API。方案(采用 DDE Architect 推荐方案)
复用遗留的
applicationHomePage(作为 link 源),并新增applicationWebsiteName(作为展示名称):改动文件
include/widgets/dapplication.hQ_PROPERTY(QString applicationHomePage ...)(补齐元对象一致性)Q_PROPERTY(QString applicationWebsiteName ...)applicationWebsiteName()/setApplicationWebsiteName()声明src/widgets/dapplication.cppapplicationWebsiteName()/setApplicationWebsiteName()(读写d->websiteName)handleAboutAction()自动建对话框段落,设置完 acknowledgement 后、setAttribute(WA_DeleteOnClose)前,按「非空才覆盖」插入:src/widgets/private/dapplication_p.hQString websiteName;CHANGELOG.mdapplicationWebsiteName属性applicationHomePage现生效于关于对话框向后兼容
applicationWebsiteNamegetter/setter 与Q_PROPERTY,以及为applicationHomePage补Q_PROPERTY,均为源码/二进制兼容的加法(DTK6 SONAME 线内)。applicationHomePage和applicationWebsiteName时,两个if (!...isEmpty())均不触发,对话框仍显示发行版默认网站。applicationHomePage从死代码变为生效:变更方向符合其文档一直承诺的用途;唯一受影响的是「调用了setApplicationHomePage却期望它什么都不做」的极端组合,实际中几乎不存在。setAboutDialog()传入的对话框不走新逻辑。测试建议
新增用例覆盖 4 个组合:
并回归:
setAboutDialog自定义对话框不受影响关联
Summary by Sourcery
Display customized application homepage links and names in automatically generated about dialogs while preserving distribution defaults when no homepage is configured.
Bug Fixes:
Enhancements:
Documentation: